package o;

import o.aea.a;

public class adq implements aea {
    private final long ʽ;
    private final int ˊ;
    private final long ˋ;
    private final long ˎ;
    private final long ˏ;
    private final int ॱ;

    public adq(long j, long j2, int i, int i2) {
        this.ˏ = j;
        this.ˎ = j2;
        if (i2 == -1) {
            i2 = 1;
        }
        this.ॱ = i2;
        this.ˊ = i;
        if (j == -1) {
            this.ˋ = -1;
            this.ʽ = -9223372036854775807L;
            return;
        }
        this.ˋ = j - j2;
        this.ʽ = ॱ(j, j2, i);
    }

    public boolean ˊ() {
        return this.ˋ != -1;
    }

    public a ˏ(long j) {
        if (this.ˋ == -1) {
            return new a(new aeh(0, this.ˎ));
        }
        long ˋ = ˋ(j);
        long ˊ = ˊ(ˋ);
        aeh o_aeh = new aeh(ˊ, ˋ);
        if (ˊ >= j || ((long) this.ॱ) + ˋ >= this.ˏ) {
            return new a(o_aeh);
        }
        ˋ += (long) this.ॱ;
        return new a(o_aeh, new aeh(ˊ(ˋ), ˋ));
    }

    public long g_() {
        return this.ʽ;
    }

    public long ˊ(long j) {
        return ॱ(j, this.ˎ, this.ˊ);
    }

    private static long ॱ(long j, long j2, int i) {
        return ((Math.max(0, j - j2) * 8) * 1000000) / ((long) i);
    }

    private long ˋ(long j) {
        return anr.ˎ((((((long) this.ˊ) * j) / 8000000) / ((long) this.ॱ)) * ((long) this.ॱ), 0, this.ˋ - ((long) this.ॱ)) + this.ˎ;
    }
}
